import java.math.BigInteger;
import java.util.*;

public class Demo {


    public static void main(String[] args) {
        PriorityQueue<Student> queue = new PriorityQueue<>(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o2.getScore() - o1.getScore();
            }
        });
        queue.add(new Student("zhangsan",15, 78));
        queue.add(new Student("lisi",18, 95));
        queue.add(new Student("wangwu", 12,88));
        queue.add(new Student("tianqi", 12,99));
        System.out.println("===========");
    }



    public static void main1(String[] args) {

        Student[] students = new Student[]{
                new Student("zhangsan",15, 78),
                new Student("lisi",18, 95),
                new Student("wangwu", 12,88)};
        System.out.println("===========");
        Arrays.sort(students);
    }

}


class Student {
    private String name;
    private int age;
    private int score;

    public Student(String name, int age, int score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public int getScore() {
        return score;
    }
}


//class Cmp_age implements Comparator<Student> {
//    @Override
//    public int compare(Student o1, Student o2) {
//        return o1.age - o2.age;
//    }
//}








class Student1 {
    String name;
    int age;

    public Student1(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object obj) {
        // 检查是否是同一个对象
        if(this == obj) return true;
        // 检查比较的对象是否为 null
        if(obj == null) return false;
        // 检查比较对象 是否为同类
        if(this.getClass() != obj.getClass()) return false;

        // 比较两个类中的所有属性
        Student1 student = (Student1) obj;
        if(this.age != student.age) return false;
        if(this.name == null && student.name == null) {
            return true;
        }else if(this.name == null || student.name == null) {
            return false;
        } else {
            return this.name.equals(student.name);
        }
    }

    public void func() {}
}